{"ast":null,"code":"import EnterOutlined from \"@ant-design/icons/es/icons/EnterOutlined\";\nimport classNames from 'classnames';\nimport KeyCode from \"rc-util/es/KeyCode\";\nimport * as React from 'react';\nimport TextArea from '../input/TextArea';\nimport { cloneElement } from '../_util/reactNode';\nimport useStyle from './style';\nconst Editable = _ref => {\n  let {\n    prefixCls,\n    'aria-label': ariaLabel,\n    className,\n    style,\n    direction,\n    maxLength,\n    autoSize = true,\n    value,\n    onSave,\n    onCancel,\n    onEnd,\n    component,\n    enterIcon = /*#__PURE__*/React.createElement(EnterOutlined, null)\n  } = _ref;\n  const ref = React.useRef(null);\n  const inComposition = React.useRef(false);\n  const lastKeyCode = React.useRef();\n  const [current, setCurrent] = React.useState(value);\n  React.useEffect(() => {\n    setCurrent(value);\n  }, [value]);\n  React.useEffect(() => {\n    if (ref.current && ref.current.resizableTextArea) {\n      const {\n        textArea\n      } = ref.current.resizableTextArea;\n      textArea.focus();\n      const {\n        length\n      } = textArea.value;\n      textArea.setSelectionRange(length, length);\n    }\n  }, []);\n  const onChange = _ref2 => {\n    let {\n      target\n    } = _ref2;\n    setCurrent(target.value.replace(/[\\n\\r]/g, ''));\n  };\n  const onCompositionStart = () => {\n    inComposition.current = true;\n  };\n  const onCompositionEnd = () => {\n    inComposition.current = false;\n  };\n  const onKeyDown = _ref3 => {\n    let {\n      keyCode\n    } = _ref3;\n    // We don't record keyCode when IME is using\n    if (inComposition.current) return;\n    lastKeyCode.current = keyCode;\n  };\n  const confirmChange = () => {\n    onSave(current.trim());\n  };\n  const onKeyUp = _ref4 => {\n    let {\n      keyCode,\n      ctrlKey,\n      altKey,\n      metaKey,\n      shiftKey\n    } = _ref4;\n    // Check if it's a real key\n    if (lastKeyCode.current === keyCode && !inComposition.current && !ctrlKey && !altKey && !metaKey && !shiftKey) {\n      if (keyCode === KeyCode.ENTER) {\n        confirmChange();\n        onEnd === null || onEnd === void 0 ? void 0 : onEnd();\n      } else if (keyCode === KeyCode.ESC) {\n        onCancel();\n      }\n    }\n  };\n  const onBlur = () => {\n    confirmChange();\n  };\n  const textClassName = component ? `${prefixCls}-${component}` : '';\n  const [wrapSSR, hashId] = useStyle(prefixCls);\n  const textAreaClassName = classNames(prefixCls, `${prefixCls}-edit-content`, {\n    [`${prefixCls}-rtl`]: direction === 'rtl'\n  }, className, textClassName, hashId);\n  return wrapSSR( /*#__PURE__*/React.createElement(\"div\", {\n    className: textAreaClassName,\n    style: style\n  }, /*#__PURE__*/React.createElement(TextArea, {\n    ref: ref,\n    maxLength: maxLength,\n    value: current,\n    onChange: onChange,\n    onKeyDown: onKeyDown,\n    onKeyUp: onKeyUp,\n    onCompositionStart: onCompositionStart,\n    onCompositionEnd: onCompositionEnd,\n    onBlur: onBlur,\n    \"aria-label\": ariaLabel,\n    rows: 1,\n    autoSize: autoSize\n  }), enterIcon !== null ? cloneElement(enterIcon, {\n    className: `${prefixCls}-edit-content-confirm`\n  }) : null));\n};\nexport default Editable;","map":{"version":3,"names":["EnterOutlined","classNames","KeyCode","React","TextArea","cloneElement","useStyle","Editable","_ref","prefixCls","ariaLabel","className","style","direction","maxLength","autoSize","value","onSave","onCancel","onEnd","component","enterIcon","createElement","ref","useRef","inComposition","lastKeyCode","current","setCurrent","useState","useEffect","resizableTextArea","textArea","focus","length","setSelectionRange","onChange","_ref2","target","replace","onCompositionStart","onCompositionEnd","onKeyDown","_ref3","keyCode","confirmChange","trim","onKeyUp","_ref4","ctrlKey","altKey","metaKey","shiftKey","ENTER","ESC","onBlur","textClassName","wrapSSR","hashId","textAreaClassName","rows"],"sources":["/data/messenger.client/node_modules/antd/es/typography/Editable.js"],"sourcesContent":["import EnterOutlined from \"@ant-design/icons/es/icons/EnterOutlined\";\nimport classNames from 'classnames';\nimport KeyCode from \"rc-util/es/KeyCode\";\nimport * as React from 'react';\nimport TextArea from '../input/TextArea';\nimport { cloneElement } from '../_util/reactNode';\nimport useStyle from './style';\nconst Editable = _ref => {\n  let {\n    prefixCls,\n    'aria-label': ariaLabel,\n    className,\n    style,\n    direction,\n    maxLength,\n    autoSize = true,\n    value,\n    onSave,\n    onCancel,\n    onEnd,\n    component,\n    enterIcon = /*#__PURE__*/React.createElement(EnterOutlined, null)\n  } = _ref;\n  const ref = React.useRef(null);\n  const inComposition = React.useRef(false);\n  const lastKeyCode = React.useRef();\n  const [current, setCurrent] = React.useState(value);\n  React.useEffect(() => {\n    setCurrent(value);\n  }, [value]);\n  React.useEffect(() => {\n    if (ref.current && ref.current.resizableTextArea) {\n      const {\n        textArea\n      } = ref.current.resizableTextArea;\n      textArea.focus();\n      const {\n        length\n      } = textArea.value;\n      textArea.setSelectionRange(length, length);\n    }\n  }, []);\n  const onChange = _ref2 => {\n    let {\n      target\n    } = _ref2;\n    setCurrent(target.value.replace(/[\\n\\r]/g, ''));\n  };\n  const onCompositionStart = () => {\n    inComposition.current = true;\n  };\n  const onCompositionEnd = () => {\n    inComposition.current = false;\n  };\n  const onKeyDown = _ref3 => {\n    let {\n      keyCode\n    } = _ref3;\n    // We don't record keyCode when IME is using\n    if (inComposition.current) return;\n    lastKeyCode.current = keyCode;\n  };\n  const confirmChange = () => {\n    onSave(current.trim());\n  };\n  const onKeyUp = _ref4 => {\n    let {\n      keyCode,\n      ctrlKey,\n      altKey,\n      metaKey,\n      shiftKey\n    } = _ref4;\n    // Check if it's a real key\n    if (lastKeyCode.current === keyCode && !inComposition.current && !ctrlKey && !altKey && !metaKey && !shiftKey) {\n      if (keyCode === KeyCode.ENTER) {\n        confirmChange();\n        onEnd === null || onEnd === void 0 ? void 0 : onEnd();\n      } else if (keyCode === KeyCode.ESC) {\n        onCancel();\n      }\n    }\n  };\n  const onBlur = () => {\n    confirmChange();\n  };\n  const textClassName = component ? `${prefixCls}-${component}` : '';\n  const [wrapSSR, hashId] = useStyle(prefixCls);\n  const textAreaClassName = classNames(prefixCls, `${prefixCls}-edit-content`, {\n    [`${prefixCls}-rtl`]: direction === 'rtl'\n  }, className, textClassName, hashId);\n  return wrapSSR( /*#__PURE__*/React.createElement(\"div\", {\n    className: textAreaClassName,\n    style: style\n  }, /*#__PURE__*/React.createElement(TextArea, {\n    ref: ref,\n    maxLength: maxLength,\n    value: current,\n    onChange: onChange,\n    onKeyDown: onKeyDown,\n    onKeyUp: onKeyUp,\n    onCompositionStart: onCompositionStart,\n    onCompositionEnd: onCompositionEnd,\n    onBlur: onBlur,\n    \"aria-label\": ariaLabel,\n    rows: 1,\n    autoSize: autoSize\n  }), enterIcon !== null ? cloneElement(enterIcon, {\n    className: `${prefixCls}-edit-content-confirm`\n  }) : null));\n};\nexport default Editable;"],"mappings":"AAAA,OAAOA,aAAa,MAAM,0CAA0C;AACpE,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,OAAO,MAAM,oBAAoB;AACxC,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,OAAOC,QAAQ,MAAM,mBAAmB;AACxC,SAASC,YAAY,QAAQ,oBAAoB;AACjD,OAAOC,QAAQ,MAAM,SAAS;AAC9B,MAAMC,QAAQ,GAAGC,IAAI,IAAI;EACvB,IAAI;IACFC,SAAS;IACT,YAAY,EAAEC,SAAS;IACvBC,SAAS;IACTC,KAAK;IACLC,SAAS;IACTC,SAAS;IACTC,QAAQ,GAAG,IAAI;IACfC,KAAK;IACLC,MAAM;IACNC,QAAQ;IACRC,KAAK;IACLC,SAAS;IACTC,SAAS,GAAG,aAAalB,KAAK,CAACmB,aAAa,CAACtB,aAAa,EAAE,IAAI;EAClE,CAAC,GAAGQ,IAAI;EACR,MAAMe,GAAG,GAAGpB,KAAK,CAACqB,MAAM,CAAC,IAAI,CAAC;EAC9B,MAAMC,aAAa,GAAGtB,KAAK,CAACqB,MAAM,CAAC,KAAK,CAAC;EACzC,MAAME,WAAW,GAAGvB,KAAK,CAACqB,MAAM,EAAE;EAClC,MAAM,CAACG,OAAO,EAAEC,UAAU,CAAC,GAAGzB,KAAK,CAAC0B,QAAQ,CAACb,KAAK,CAAC;EACnDb,KAAK,CAAC2B,SAAS,CAAC,MAA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